package com.hsgene.user.controller.sms;

import com.hsgene.common.util.resolver.IgnoreUserToken;
import com.hsgene.common.util.result.ApiResult;
import com.hsgene.common.util.result.NullObject;
import com.hsgene.user.service.SmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 短信相关接口
 *
 * @author wangbing
 * @version 1.0, 2018/7/9
 */
@RestController
@RequestMapping("/v1.0/genetic/testing/sms")
public class GeneticUserSmsController {

    @Autowired
    private SmsService smsService;

    /**
     * 获取短信登录验证码
     *
     * @param phone 登录手机号码
     * @return 短信发送结果
     */
    @IgnoreUserToken
    @RequestMapping(value = "login_code", method = RequestMethod.GET)
    public ApiResult<NullObject> getLoginCode(
            @RequestParam("phone") String phone) {
        return smsService.sendLoginCode(phone);
    }
}
